<?php
/**
 * Created by PhpStorm.
 * User: 李振磊
 * Date: 2019/4/16
 * Time: 23:24
 */

$serv = new swoole_server('127.0.0.1',9501);

$serv->on('connect',function ($serv,$fd){
    echo "Client: Connect.\n";
});

$serv->on('receive',function ($serv,$fd,$from_id,$data){
    $serv->send($fd,"Server:",$data);
});

$serv->on('close',function ($serv,$fd){
    echo "client:Close.''\n";
});

$serv->start();